<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <base href="<%=basePath%>">
    
    <title>圈子主页</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<style type="text/css">
		body{
		 margin:0px;
		 background-image:url('<%=basePath%>images/background4.jpg');
		 background-repeat:no-repeat;
		}
		.tb_th{
			border:0;
			
		}
		
		.tb_td{
			border:0px;
		}
		.tb_hr{ height:0px;border:none;border:1px solid #D5FFFF;}
		
		.personal_font1{
			color:#400000;
			font-size:11pt;
			font-family:微软雅黑;
		}
		.personal_font2{
			color:#400000;
			font-size:10pt;
			font-family:微软雅黑;
		}
				
		 div#topiclist a:link {color:#400000;text-decoration:none;font-size:11pt;font-family:微软雅黑;} /* 未访问的链接 */
		 div#topiclist a:visited {color:#400000;text-decoration:none;font-size:11pt;font-family:微软雅黑;} /* 已访问的链接 */
		 div#topiclist a:hover {color:#400000;text-decoration:underline;font-size:11pt;font-family:微软雅黑;} /* 鼠标移动到链接上 */
		 div#topiclist a:active {color: #400000;font-size:11pt;font-family:微软雅黑;} /* 选定的链接 */
		
	</style>

  </head>

  <body>
    <jsp:include page="../head.jsp"></jsp:include>
	<jsp:include page="./club_frame.jsp"></jsp:include>

	
	<table id="list_data" width="100%" height="" border="0px" bgcolor="" padding="10px">
		<tr height="30px" bgcolor="#D5D3D4">
			<th width="50%" class="tb_th">主题</th>
			<th width="5%" class="tb_th">浏览</th>
			<th width="5%" class="tb_th">回复</th>
			<th width="20%" class="tb_th">发布时间</th>
			<th width="20%" class="tb_th">最后回复</th>
		</tr>
			
 		<s:iterator id="topiclist" value="topiclist" status="u">
		<tr height="20px">
			<td align="left" class="tb_td">
				<div id="topiclist" style="padding-left:10px;">
				<a href="<%=basePath%>club_reviewTopicAction?&orderflag=${pagebean.orderflag}&topicClassifyId=${pagebean.topicClassifyId}&page=1&rows=10&topicid=<s:property value="#topiclist.topicId"/>&docid=${doctorinfo.doctorId}">
					<!-- 判断标题的长度 -->
					<s:if test="#topiclist.topicTitle.length()<37">
						<s:property value="#topiclist.topicTitle" />
					</s:if>
					<s:else>
					    <s:property value="%{#topiclist.topicTitle.substring(0, 37) + \"...\"}"/>
					</s:else>
					
				</a>
				</div>
			</td>
			<td align="center" class="tb_td">
				 <span class="personal_font2"><s:property value="#topiclist.scanNumber" /></span>
			</td>
			<td align="center" class="tb_td">
				<span class="personal_font2"> <s:property value="#topiclist.commentNumber" /></span>
		    </td>
			<td align="center" class="tb_td">
				<span class="personal_font2">
					<s:property value="topicuserlist[#u.index].userName"/><br/>
					<s:property value="#topiclist.topicCreatedTime" />
				</span>
			 </td>
			<td align="center" class="tb_td">
				 <span class="personal_font2">
					 <s:property value="#topiclist.latestCommentUserName" /><br/>
					 <s:property value="#topiclist.latestCommentTime" />
				 </span>
		    </td>
		</tr>
		<s:if test="!#u.last">
			<tr height="1px">
				 <td colspan="5" class="tb_td"><hr class="tb_hr" /></td>
			</tr>
		</s:if>
		</s:iterator>
		
	</table>
	</div>
	<!-- 实现分页及跳转页面功能JS -->
	<script type="text/javascript">
		function jumpPage(){
			var input_page=document.getElementById("input_page").value;
			var hidden_totalpage=document.getElementById("hidden_totalpage").value;
			var pattern=/^[0-9]*[1-9][0-9]*$/;
			var flag = pattern.test(input_page);
			if(flag){
				if(input_page>0&&input_page<=hidden_totalpage){
					window.location.href="<%=basePath%>club_selectClubAction?clubid=${club.clubCategoryId}&topicClassifyId=${topicClassifyId}&orderflag=${orderflag}&rows=${pagebean.rows}&page="+input_page;
				}
				else{
					document.getElementById("validateMsg").innerHTML="请选择正确的页码！";
					document.getElementById("validateMsg").style.color="red";
				}
			}
			else{
				document.getElementById("validateMsg").innerHTML="请选择正确的页码！";
				document.getElementById("validateMsg").style.color="red";
			}
		}
		
		function check_select_pagesize(){
			var select_pagesize=document.getElementById("select_pagesize").value;
			window.location.href="<%=basePath%>club_selectClubAction?clubid=${club.clubCategoryId}&topicClassifyId=${topicClassifyId}&orderflag=${orderflag}&page=1&rows="+select_pagesize;
		}
	</script>
	
	<div class="page_direction">
		<input type="hidden" id="hidden_totalpage" value="${pagebean.totalpage}">
		<!-- 设置每页显示的条数 -->
		每页显示
		<select id="select_pagesize" onchange=check_select_pagesize(this.value)>
			<option value="10"
			    <s:if test="pagebean.rows==10">selected</s:if>>10
			</option>
			<option value="15"
			    <s:if test="pagebean.rows==15">selected</s:if>>15
			</option>
			<option value="20"
			    <s:if test="pagebean.rows==20">selected</s:if>>20
			</option>
			<option value="30"
			    <s:if test="pagebean.rows==30">selected</s:if>>30
			</option>
		</select>条
		<!-- 判断是否是第一页，如果是就不显示上一页按钮 -->
		<s:if test="pagebean.currpage!=1">
			<a href="<%=basePath%>club_selectClubAction?clubid=${club.clubCategoryId}&page=${pagebean.currpage-1}&rows=${pagebean.rows}&topicClassifyId=${pagebean.topicClassifyId}&orderflag=${pagebean.orderflag}"><span class="page_direction_text">上一页</span></a>
		</s:if>
		<!-- 判断是否是最后一页，如果是就不显示下一页按钮 -->
		<s:if test="pagebean.currpage<pagebean.totalpage">
			<a href="<%=basePath%>club_selectClubAction?clubid=${club.clubCategoryId}&page=${pagebean.currpage+1}&rows=${pagebean.rows}&topicClassifyId=${pagebean.topicClassifyId}&orderflag=${pagebean.orderflag}"><span class="page_direction_text">下一页</span></a>
		</s:if>
		<!-- 如果页数大于1，提供跳转 -->
		<s:if test="pagebean.totalpage>1">
				跳转到<input type="text" id="input_page" size="2" value="1"/>页
				<input type="button" value="跳转" onclick="jumpPage();">
		</s:if>
		当前第<span class="page_direction_text">${pagebean.currpage}</span>页，共
		<span class="page_direction_text">${pagebean.totalpage}</span>页
		<span class="page_direction_text">${pagebean.totalrecords}</span>篇
		<span id="validateMsg"></span>
	</div>
	
	</div>
    <%@ include file="../foot.jsp"%>
  </div>
  </body>
</html>